package org.hibernate.tutorial.domain;

import java.util.*;

import org.hibernate.tutorial.domain.Event;

public class Person {
	private Long id;
	private int age;
	private String firstname;
	private String lastname;
	private Set events = new HashSet();
	private Set emailAddresses = new HashSet();
	
	public Person() {
	}
	
	private void setId(Long id){
		this.id = id;
	}
	
	public Long getId(){
		return id;
	}
	
	public void setAge(int age){
		this.age = age;
	}
	
	public int getAge(){
		return age;
	}
	
	public void setFirstname(String firstname){
		this.firstname = firstname;
	}
	
	public String getFirstname(){
		return firstname;
	}
	public void setLastname(String lastname){
		this.lastname = lastname;
	}
	
	public String getLastname(){
		return lastname;
	}
	
	protected void setEvents(Set events){
		this.events = events;
	}
	
	protected Set getEvents(){
		return events;
	}
	
    public void addToEvent(Event event) {
        this.getEvents().add(event);
        event.getParticipants().add(this);
    }

    public void removeFromEvent(Event event) {
        this.getEvents().remove(event);
        event.getParticipants().remove(this);
    }
	
	public void setEmailAddresses(Set emailAddresses){
		this.emailAddresses = emailAddresses;
	}
	
	public Set getEmailAddresses(){
		return emailAddresses;
	}

	
}